/**
 * @fileOverview
 * @author iNahoo
 * @since 2019/11/30.
 */


const R = require('robotjs');
const fs = require('fs');
const {createCanvas, createImageData , Image} = require('canvas');

const C = R.screen.capture();

const image = createImageData(new Uint8ClampedArray(C.image), C.width, C.height);
const c = createCanvas(C.width, C.height);
const ctx = c.getContext('2d');
ctx.putImageData(image, 0, 0);

fs.writeFileSync(__dirname + Math.random() + '.jpg', c.toBuffer());
